#!/usr/bin/env python
import pygtk
pygtk.require('2.0')

import gtk
import os
import gnomeapplet
import gobject

def show_about():
    pass


def button_pressed(button, event):
    if event.type == gtk.gtk.BUTTON_PRESS and event.button == 1:
        pass

def tangerine_factory(applet, iid):
    print "Creating new applet instance"
    img = gtk.Image()
    pix = gtk.gdk.pixbuf_new_from_file_at_size("/data/packages/tangerine/tangerine.svg", 24,24)
    img.set_from_pixbuf(pix)
    applet.add(img)
    verb_list = [("About", show_about)]
    uifile = os.path.join(os.getcwd(), "GNOME_TangerineMenu.xml")
    applet.setup_menu_from_file(None, uifile, "Tangerine", verb_list)
    #applet.connect("button-press-event", button_pressed)
    applet.show_all()
    return True

#print "Starting factory"
gnomeapplet.bonobo_factory("OAFIID:GNOME_TangerineApplet_Factory", 
                           gnomeapplet.Applet.__gtype__, 
                           "Tangerine", "0", tangerine_factory)
#print "Factory ended"

